package cn.itcast.feign.client.fallback;

import cn.itcast.feign.client.UserClient;
import cn.itcast.feign.pojo.User;
import feign.hystrix.FallbackFactory;

public class UserClientFallbackFactory implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable throwable) {
        System.err.println(throwable);
        return new UserClient() {
            @Override
            public User findById(Long id) {
                System.err.println("出现异常"+throwable);
                return new User();
            }
        };
    }
}
